package com.china08.yxyapi.repository.db;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.china08.yxyapi.entity.db.res.YxyResBookContents;

public interface YxyResBookContentsRepository extends JpaRepository<YxyResBookContents, String> {

    List<YxyResBookContents> findByBookIdAndIsViewOrderByOrderNum(String bookid, Integer isview);

    List<YxyResBookContents> findByBookIdAndIsViewAndPIdOrderByOrderNum(String bookid, Integer isview, String pid);

    List<YxyResBookContents> findByPIdAndIsViewOrderByOrderNum(String pid, Integer isview);

    @Query(value = "select id  from YxyResBookContents where pId in ?1")
    List<String> findTocIdByParentTocId(List<String> parentIds);

    @Query(value = "select id  from YxyResBookContents where isView = 1 and bookId=?1")
    List<String> findIdByBookId(String bookId);

    YxyResBookContents findById(String bookContentId);

    List<YxyResBookContents> findByIdIn(List<String> bookContentPidListIds);

    List<YxyResBookContents> findByIsUpdate(Integer isUpdate);

}
